//
//  DENFavorableViewController.m
//  Icar
//
//  Created by apple on 15/10/16.
//  Copyright © 2015年 小龙侠. All rights reserved.
//

#import "DENFavorableViewController.h"
#import "BaseHeader.h"
#import "HSPActivityTableViewCell.h"
#import "HSPWebViewController.h"
#import "HSPActivityModel.h"
#import "HSPRightCell.h"
#import "HSPWebChangeViewController.h"
@interface DENFavorableViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)UITableView *tablepreferential;//优惠
@property (nonatomic,strong)UITableView *tableactivity;//活动
@property (nonatomic,strong)UIView *titleView;
@property (nonatomic,strong)UISegmentedControl *seg;//分段选择器
@property (nonatomic,strong)UIScrollView *scView;
@property (nonatomic,assign)BOOL isUp;
@property (nonatomic,assign)NSInteger page;//NO = 页数
@property (nonatomic,strong)NSMutableArray *preferentialArray;//优惠数组
@property (nonatomic,strong)NSMutableArray *activityArray;//活动数组
@property (nonatomic,strong)HSPWebViewController *push;//Web页面push
@property (nonatomic,strong)DENFavorableModel *phoneModel;//优惠页面model
@property (nonatomic,strong)UIAlertView *alert;//提示框
@property (nonatomic,strong)UIButton *buttnArea;//地区按钮
@property (nonatomic,strong)UITableView *tableRight;//地区选择tableView;
@property (nonatomic,strong)NSMutableArray *rightArray;//地区页面数组
@property (nonatomic,strong)NSArray *arrayFirst;//Key值
@property (nonatomic,strong)NSDictionary *dicChange;//back返回的数组
@property (nonatomic,strong)NSMutableArray *arrSecond;//每个数组中的字典个数
@property (nonatomic,strong)NSDictionary *dicDictiony;//接受字典
@property (nonatomic,strong)UIButton *darkView;
@property (nonatomic,copy)NSString *strValue;
@property (nonatomic,strong)MBProgressHUD *HUD;

@end

@implementation DENFavorableViewController
- (void)viewWillAppear:(BOOL)animated
{
    [_tableactivity reloadData];
    [_tablepreferential reloadData];
    _tablepreferential.backgroundColor = [LYYNightModeHandle shareNightModeHandle].nightModeColor;
    _tableactivity.backgroundColor = [LYYNightModeHandle shareNightModeHandle].nightModeColor;

}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationController.navigationBar.hidden = YES;
    self.rightArray = [[NSMutableArray alloc]init];
    self.preferentialArray = [[NSMutableArray alloc]init];
    //View
    _titleView = [[UIView alloc] initWithFrame:CGRectMake(0,0, SCREEN_WIDTH, 64)];
    [_titleView setBackgroundColor:BLUECOLOR];
    [self.view addSubview:_titleView];
    //分段选择器
    NSArray *titleArray = [NSArray arrayWithObjects:@"优惠",@"活动", nil];
    _seg = [[UISegmentedControl alloc]initWithItems:titleArray];
    _seg.frame = CGRectMake(87.5 * ADJUSTWIDTH, 25 * ADJUSTHEIGHT, ADJUSTWIDTH * 200, ADJUSTHEIGHT * 35);
    [_seg setTintColor:[UIColor whiteColor]];
    _seg.layer.cornerRadius = 3.;
    _seg.layer.masksToBounds = YES;
    [_seg setSelectedSegmentIndex:0];
    [_seg addTarget:self action:@selector(Click:) forControlEvents:UIControlEventValueChanged];
    [_titleView addSubview:_seg];
    //坐标图片
    UIImage *image1 = [UIImage imageNamed:@"iconfont-zuobiao.png"];
    UIImage *img1 = [self scaleToSize:image1 size:CGSizeMake(30 * ADJUSTWIDTH, 30 * ADJUSTHEIGHT)];
    //坐标点击
    self.buttnArea = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.buttnArea setFrame:CGRectMake(255 * ADJUSTWIDTH, 25 * ADJUSTHEIGHT, 150 * ADJUSTWIDTH, 30 * ADJUSTHEIGHT)];
    [self.buttnArea setImage:img1 forState:UIControlStateNormal];
    [self.buttnArea setTitle:@"广州市" forState:UIControlStateNormal];
    self.buttnArea.titleLabel.font = [UIFont systemFontOfSize:15.];
    [self.buttnArea addTarget:self action:@selector(right) forControlEvents:UIControlEventTouchUpInside];
    [self.titleView addSubview:self.buttnArea];
    //self.darkView.hidden = YES;
    //活动ScrollView
    _scView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, ADJUSTHEIGHT * 554)];
    [_scView setContentSize:CGSizeMake(SCREEN_WIDTH * 3, 0)];
    [_scView setBounces:YES];
    [_scView setPagingEnabled:YES];
    [_scView setDelegate:self];
    [_scView showsHorizontalScrollIndicator];
    _scView.backgroundColor = [LYYNightModeHandle shareNightModeHandle].nightModeColor;
    [self.view addSubview:_scView];
    [self creatpreferential];
    [self creatactivity];
    [self rightView];
    [self AlbumaHeader];
    [self AlbumaFooter];
    [self AlbumaHeaderactivity];
    
    
    UISwipeGestureRecognizer *swi = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swi:)];
    [_tableRight addGestureRecognizer:swi];
    [swi setDirection:UISwipeGestureRecognizerDirectionRight];
    
    
}
- (void)right
{
    self.darkView = [[UIButton alloc] initWithFrame:CGRectMake(0, 64, ADJUSTWIDTH * 100, SCREEN_HEIGHT)];
    [self.darkView setBackgroundColor:[UIColor blackColor]];
    [self.darkView addTarget:self action:@selector(darkClick) forControlEvents:UIControlEventTouchUpInside];
    self.darkView.alpha = 0.5;
    [self.view addSubview:self.darkView];
    [UIView animateWithDuration:0.7 animations:^{
        
        _tableRight.frame = CGRectMake(100 * ADJUSTWIDTH, 0 * ADJUSTHEIGHT, ADJUSTHEIGHT * 275, ADJUSTHEIGHT * 628);
    }];
}
- (void)swi : (UISwipeGestureRecognizer *)swi

{
    [UIView animateWithDuration:1.0 animations:^{
        _tableRight.frame = CGRectMake(SCREEN_WIDTH * 2, 0 * ADJUSTHEIGHT, SCREEN_WIDTH, ADJUSTHEIGHT * 628);
        self.darkView.hidden = YES;
    }];
}
- (void)rightView
{
    _tableRight = [[UITableView alloc]initWithFrame:CGRectMake(SCREEN_WIDTH * 1, 0 * ADJUSTHEIGHT, SCREEN_WIDTH, ADJUSTHEIGHT * 628) style:UITableViewStylePlain];
    _tableRight.delegate = self;
    _tableRight.dataSource = self;
    [self.view addSubview:_tableRight];
    UILabel *rangeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 40 * ADJUSTHEIGHT, ADJUSTHEIGHT * 200, 40 * ADJUSTHEIGHT)];
    [rangeLabel setText:@"地区选择"];
    [rangeLabel setTextColor:[UIColor grayColor]];
    rangeLabel.backgroundColor = [LYYNightModeHandle shareNightModeHandle].nightModeColor;
    [rangeLabel setTextAlignment:NSTextAlignmentCenter];
    [self.tableRight setTableHeaderView:rangeLabel];
    self.arrayFirst = [NSArray arrayWithObjects:@"A",@"B",@"C",@"D",@"E",@"F",@"G",@"H",@"J",@"K",@"L",@"M",@"N",@"P",@"Q",@"R",@"S",@"T",@"W",@"X",@"Y",@"Z", nil];
    [self opqik];
}
- (void)opqik
{
    [AFNBlock getDataWithString:[NSString stringWithFormat:@"http://mrobot.pcauto.com.cn/v2/cms/area_tree?order=alpha"] block:^(id back) {
        _dicChange = back;
        [_tableRight reloadData];
    }];
}
- (UIImage *)scaleToSize : (UIImage *)img size:(CGSize)size
{
    UIGraphicsBeginImageContext(size);
    [img drawInRect:CGRectMake(0, 0, size.width, size.height)];
    UIImage *scaledImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return scaledImage;
}

#pragma 活动上拉刷新
- (void)AlbumaHeaderactivity
{
    __block DENFavorableViewController *vc = self;
    [_tableactivity addLegendHeaderWithRefreshingBlock:^{
        vc.page = 1;
        [vc APPadndatanumberactivity :1];
        _isUp = YES;
    }];
    [_tableactivity.header beginRefreshing];
}
#pragma 活动下拉加载
- (void)AlbumaFooteractivity
{
    __block DENFavorableViewController *vcc = self;
    [_tableactivity addLegendFooterWithRefreshingBlock:^{
        vcc.page = vcc.page + 1;
        [vcc APPadndatanumberactivity:vcc.page];
        _isUp = NO;
    }];
}
- (void)APPadndatanumberactivity:(NSInteger)number
{
    NSString *documentString = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES)lastObject];
    NSString *pathString = [documentString stringByAppendingString:@"activity.plist"];
    if ([Reachability isConnectedInternet] == YES) {
        self.activityArray = [[NSMutableArray alloc]init];
        [AFNBlock getDataWithString:[NSString stringWithFormat:@"http://mrobot.pcauto.com.cn/buy/price/activityListv11/2?pageNo=%ld&regionId=%@&pageSize=20",_page,_strValue] block:^(id back) {
            if (_isUp == YES) {
                [self.activityArray removeAllObjects];
            }
            for (NSDictionary *dica in [back objectForKey:@"data"]) {
                HSPActivityModel *modelActivity = [HSPActivityModel modelWithDictionary:dica];
                [self.activityArray addObject:modelActivity];
                
            }
            [self.tableactivity reloadData];
            [self.tableactivity.header endRefreshing];
            [self.tableactivity.footer endRefreshing];
            [NSKeyedArchiver archiveRootObject:_activityArray toFile:pathString];
        }];
    }
    if (ISCONENNCTED == NO) {
        if (_isUp == YES) {
            [_activityArray removeAllObjects];
        }
        //读取
        self.activityArray = [NSMutableArray arrayWithArray:[NSKeyedUnarchiver unarchiveObjectWithFile:pathString]];
        [_tableactivity reloadData];
        [_tableactivity.header endRefreshing];
        [_tableactivity.footer endRefreshing];
    }
    
}
#pragma 优惠上拉刷新
- (void)AlbumaHeader
{
    __block DENFavorableViewController *vc = self;
    [_tablepreferential addLegendHeaderWithRefreshingBlock:^{
        vc.page = 1;
        [vc APPadndatanumber :1];
        _isUp = YES;
    }];
    [_tablepreferential.header beginRefreshing];
}
#pragma 优惠下拉加载
- (void)AlbumaFooter
{
    __block DENFavorableViewController *vcc = self;
    [_tablepreferential addLegendFooterWithRefreshingBlock:^{
        vcc.page = vcc.page + 1;
        [vcc APPadndatanumber:vcc.page];
        _isUp = NO;
    }];
}
#pragma 优惠
- (void)APPadndatanumber:(NSInteger)number
{
    NSString *documentString = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES)lastObject];
    NSString *pathString = [documentString stringByAppendingString:@"preferential.plist"];
    if ([Reachability isConnectedInternet] == YES) {

        [AFNBlock getDataWithString:[NSString stringWithFormat:@"http://mrobot.pcauto.com.cn/v3/price/promotionList?areaId=%@&pageNo=%ld&orderBy=discountRange&pageSize=20",_strValue,_page] block:^(id back) {
            if (_isUp == YES) {
                [self.preferentialArray removeAllObjects];
            }
            for (NSDictionary *dica in [back objectForKey:@"data"]) {
                DENFavorableModel *modelpreferential = [DENFavorableModel modelWithDictionary:dica];
                [self.preferentialArray addObject:modelpreferential];
           
            }
            
            [self.tablepreferential reloadData];
            [self.tablepreferential.header endRefreshing];
            [self.tablepreferential.footer endRefreshing];
            [NSKeyedArchiver archiveRootObject:_preferentialArray toFile:pathString];
        }];
    }
    if (ISCONENNCTED == NO) {
        if (_isUp == YES) {
            [_preferentialArray removeAllObjects];
        }
        //读取
        self.preferentialArray = [NSMutableArray arrayWithArray:[NSKeyedUnarchiver unarchiveObjectWithFile:pathString]];
        [_tablepreferential reloadData];
        [_tablepreferential.header endRefreshing];
        [_tablepreferential.footer endRefreshing];
    }
    
}
//优惠页面创建tableView
- (void)creatpreferential
{
    _tablepreferential = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ADJUSTHEIGHT * 554) style:UITableViewStylePlain];
    _tablepreferential.delegate = self;
    _tablepreferential.dataSource = self;
    _tablepreferential.backgroundColor = [LYYNightModeHandle shareNightModeHandle].nightModeColor;
    [_scView addSubview:_tablepreferential];
    UILabel *footLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,0, SCREEN_WIDTH, 50 * ADJUSTHEIGHT)];
    [footLabel setText:@">_<暂时就这么多了哦"];
    [footLabel setTextAlignment:NSTextAlignmentCenter];
    [footLabel setFont:[UIFont systemFontOfSize:19. * ADJUSTWIDTH]];
    [footLabel setTextColor:[UIColor grayColor]];
    [self.tablepreferential setTableFooterView:footLabel];
}
-(void)darkClick
{
    [UIView animateWithDuration:0.5 animations:^{
        _tableRight.frame = CGRectMake(SCREEN_WIDTH, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
        [self.view bringSubviewToFront:_tableRight];
        self.darkView.hidden = YES;
    }];
}
//活动页面创建tableView
- (void)creatactivity
{
    _tableactivity = [[UITableView alloc]initWithFrame:CGRectMake(SCREEN_WIDTH, 0, SCREEN_WIDTH, ADJUSTHEIGHT * 554) style:UITableViewStylePlain];
    _tableactivity.delegate = self;
    _tableactivity.dataSource = self;
    _tableactivity.backgroundColor = [LYYNightModeHandle shareNightModeHandle].nightModeColor;
    [_scView addSubview:_tableactivity];
    UILabel *footLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,0, SCREEN_WIDTH, 50 * ADJUSTHEIGHT)];
    [footLabel setText:@">_<暂时就这么多了哦"];
    [footLabel setTextAlignment:NSTextAlignmentCenter];
    [footLabel setFont:[UIFont systemFontOfSize:19. * ADJUSTWIDTH]];
    [footLabel setTextColor:[UIColor grayColor]];
    [self.tableactivity setTableFooterView:footLabel];
}
//滑动
- (void)Click:(UISegmentedControl *)sender
{
    if (sender.selectedSegmentIndex == 0) {
        [_scView setContentOffset:CGPointMake(0, 0) animated:YES];
    }
    if (sender.selectedSegmentIndex == 1) {
        [_scView setContentOffset:CGPointMake(SCREEN_WIDTH, 0) animated:YES];
    }
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    [_seg setSelectedSegmentIndex:_scView.contentOffset.x / SCREEN_WIDTH ];
}
//地区tableView的section个数
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    if ([tableView isEqual:_tablepreferential]) {
        return 1;
    }
    else if ([tableView isEqual:_tableactivity])
    {
        return 1;
    }
    return _arrayFirst.count;
}
//cell个数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if ([tableView isEqual:_tablepreferential]) {
        return _preferentialArray.count;
    }
    if ([tableView isEqual:_tableRight]) {
        NSString *str = [self.arrayFirst objectAtIndex:section];
        _arrSecond = [_dicChange objectForKey:str];
        return _arrSecond.count;
    }
    return _activityArray.count;
}
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index
{
    if ([tableView isEqual:_tableRight]) {
        _HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
        _HUD.removeFromSuperViewOnHide = YES;
        _HUD.labelText = title;
        _HUD.labelFont = [UIFont systemFontOfSize:30.];
        _HUD.margin = 40.f;
        _HUD.center = self.view.center;
        [_HUD hide:YES afterDelay:1];
        [self.view addSubview:_HUD];
        [_HUD setMode:MBProgressHUDModeCustomView];
    }
    return index;
}
//cell高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if ([tableView isEqual:_tablepreferential]) {
        return 160 * ADJUSTHEIGHT;
    }
    if ([tableView isEqual:_tableRight]) {
        return 50 * ADJUSTHEIGHT;
    }
    return 140 * ADJUSTHEIGHT;
}
//title
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
    if ([tableView isEqual:_tableRight]) {
        return [_arrayFirst objectAtIndex:section];
    }
    return nil;
}
#pragma mark - 索引 数组
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
{
    if ([tableView isEqual:_tableRight]) {
        return _arrayFirst;
    }
    return nil;
}
//赋值
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if ([tableView isEqual:_tablepreferential]) {
        DENFavorableTAbleViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
        if (cell == nil) {
            cell = [[DENFavorableTAbleViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
        }
        DENFavorableModel *model = [self.preferentialArray objectAtIndex:indexPath.row];
        self.tablepreferential.scrollsToTop = YES;
        [cell getDenMessage:model];
        [cell.phoneButton addTarget:self action:@selector(phoneClick1:) forControlEvents:UIControlEventTouchUpInside];
        [cell.phoneButton setTag:indexPath.row];
        [cell.privilegeButton addTarget:self action:@selector(privilegeButton1:) forControlEvents:UIControlEventTouchUpInside];
        [cell.privilegeButton setTag:indexPath.row];
        cell.namelistRangeLabel.backgroundColor = [LYYNightModeHandle shareNightModeHandle].backColor;
        cell.modelType.backgroundColor = [LYYNightModeHandle shareNightModeHandle].backColor;
        cell.privilegeButton.backgroundColor = [LYYNightModeHandle shareNightModeHandle].nightModeColor;
        cell.phoneButton.backgroundColor = [LYYNightModeHandle shareNightModeHandle].nightModeColor;
        cell.label.backgroundColor = [LYYNightModeHandle shareNightModeHandle].backColor;
        cell.backgroundColor = [LYYNightModeHandle shareNightModeHandle].nightModeColor;
        cell.modelNameLabel.textColor = [LYYNightModeHandle shareNightModeHandle].wordColor;
        return cell;
    }
    if ([tableView isEqual:_tableactivity]) {
        HSPActivityTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"activity"];
        if (cell == nil) {
            cell = [[HSPActivityTableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"activity"];
        }
        HSPActivityModel *model = [self.activityArray objectAtIndex:indexPath.row];
        self.tablepreferential.scrollsToTop = YES;
        [cell getActiviay:model];
        cell.backgroundColor = [LYYNightModeHandle shareNightModeHandle].nightModeColor;
        cell.titleLabel.textColor = [LYYNightModeHandle shareNightModeHandle].wordColor;
        return cell;
    }
    if ([tableView isEqual:_tableRight]) {
        HSPRightCell *cell = [tableView dequeueReusableCellWithIdentifier:@"city"];
        if (cell == nil) {
            cell = [[HSPRightCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"city"];
        }
        NSString *str = [self.arrayFirst objectAtIndex:indexPath.section];
        NSMutableArray *arr = [_dicChange objectForKey:str];
        _dicDictiony = [arr objectAtIndex:indexPath.row];
        cell.cityIpLabel.text = [_dicDictiony objectForKey:@"cityIp"];
        return cell;
    }
    return nil;
}
//优惠页面按钮
- (void)phoneClick1:(UIButton *)sender
{
    _phoneModel = [self.preferentialArray objectAtIndex:sender.tag];
    _alert = [[UIAlertView alloc]initWithTitle:@"是否拨打" message:_phoneModel.phone delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
    [_alert show];
}
//alertView代理方法
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (alertView == _alert) {
        if (buttonIndex == 1) {
            //打完电话后还会回到原来的程序，也会弹出提示
            NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",_phoneModel.phone];
            if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:str]]) {
                UIWebView * callWebview = [[UIWebView alloc] init];
                [callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];
                [self.view addSubview:callWebview];
            }
            else
            {
                UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"号码不可用\n或您的备设不支持拨号功能" message:nil delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:nil, nil];
                [alertView show];
                
            }
        }
    }
}
//优惠Web
- (void)privilegeButton1:(UIButton *)sender
{
    HSPWebChangeViewController *change = [[HSPWebChangeViewController alloc]init];
    change.modelChange = [self.preferentialArray objectAtIndex:sender.tag];
    [self.navigationController pushViewController:change animated:YES];
}
//点击方法
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    if ([tableView isEqual:_tablepreferential]) {
        _push = [[HSPWebViewController alloc]init];
    DENFavorableModel *model = [self.preferentialArray objectAtIndex:indexPath.row];
        _push.modelFavorable = model;
        [self.navigationController pushViewController:_push animated:YES];
    }
    else if ([tableView isEqual:_tableactivity])
    {
        _push = [[HSPWebViewController alloc]init];
        _push.modelActivity = [self.activityArray objectAtIndex:indexPath.row];
        _push.strValueChange = _strValue;
        [self.navigationController pushViewController:_push animated:YES];
    }
    else if ([tableView isEqual:_tableRight])
    {
        [UIView animateWithDuration:1.0 animations:^{
            _tableRight.frame = CGRectMake(SCREEN_WIDTH * 2, 0 * ADJUSTHEIGHT, SCREEN_WIDTH, ADJUSTHEIGHT * 628);
            self.darkView.hidden = YES;
        }];
        [self.buttnArea setTitle:[[[_dicChange objectForKey:[self.arrayFirst objectAtIndex:indexPath.section]] objectAtIndex:indexPath.row] objectForKey:@"cityIp"] forState:UIControlStateNormal];
        
        _strValue = [[[_dicChange objectForKey:[self.arrayFirst objectAtIndex:indexPath.section]] objectAtIndex:indexPath.row] objectForKey:@"areaId"];
        [self AlbumaHeader];
        [self AlbumaFooter];
        [self AlbumaHeaderactivity];
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
